home *** CD-ROM | disk | FTP | other *** search
- #include "packets.h"
-
- word theDelay = DEFAULT_DELAY,
- theSize = DEFAULT_SIZE;
- char theZone[33] = "*";
- char theName[33] = "=";
- uword theTestSize = TEST_SIZE_K;
- word theBDSCount = DEFAULT_BDS_COUNT;
-
- Configure()
- {
- DialogPtr dp;
- word item;
-
- dp = GetNewDialog(128, (Ptr)0, (WindowPtr)-1L);
-
- SetDialogNumber(dp, 5, theDelay);
- SetDialogNumber(dp, 6, theSize);
- SetDialogText(dp, 14, theName);
- SetDialogText(dp, 8, theZone);
- SetDialogNumber(dp, 10, theTestSize);
- SetDialogNumber(dp, 12, theBDSCount);
-
- if (dp)
- {
- do {
- ModalDialog((ProcPtr)0, &item);
- }
- while (item > 2);
- }
-
- if (item == 1)
- {
- GetDialogNumber(dp, 5, &theDelay);
- GetDialogNumber(dp, 6, &theSize);
- GetDialogText(dp, 14, theName, 32);
- GetDialogText(dp, 8, theZone, 32);
- GetDialogNumber(dp, 10, &theTestSize);
- GetDialogNumber(dp, 12, &theBDSCount);
-
- if (theSize > 512)
- { SysBeep(10); theSize = 512; }
- }
-
- DisposDialog(dp);
- }
-
- SetDialogNumber(dp, item, number)
- DialogPtr dp;
- uword item, number;
- {
- word dtype;
- Handle dhandle;
- Rect dbox;
- char text[256];
-
- GetDItem(dp, item, &dtype, &dhandle, &dbox);
- if (dhandle)
- {
- sprintf(text, "%u", number);
- CtoPstr(text);
- SetIText(dhandle, text);
- }
- }
-
- SetDialogText(dp, item, str)
- DialogPtr dp;
- word item;
- char *str;
- {
- word dtype;
- Handle dhandle;
- Rect dbox;
- char text[256];
-
- GetDItem(dp, item, &dtype, &dhandle, &dbox);
- if (dhandle)
- {
- strcpy(text, str);
- CtoPstr(text);
- SetIText(dhandle, text);
- }
- }
-
- GetDialogNumber(dp, item, number)
- DialogPtr dp;
- uword item, *number;
- {
- word dtype;
- Handle dhandle;
- Rect dbox;
- char text[256];
-
- GetDItem(dp, item, &dtype, &dhandle, &dbox);
- if (dhandle)
- {
- GetIText(dhandle, text);
- text[ text[0]+1 ] = '\0';
- *number = atoi( text+1 );
- return 1;
- }
-
- return 0;
- }
-
- GetDialogText(dp, item, str, max)
- DialogPtr dp;
- word item;
- char *str;
- word max;
- {
- word dtype;
- Handle dhandle;
- Rect dbox;
- char text[256];
-
- GetDItem(dp, item, &dtype, &dhandle, &dbox);
- if (dhandle)
- {
- GetIText(dhandle, text);
- text[ text[0]+1 ] = '\0';
- if (text[0] > max)
- text[max] = '\0';
-
- ptoccpy(str, text);
- return 1;
- }
-
- return 0;
- }
-
-